<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let arr = ['a', 'b', 'c', 'd']
    const go = (array, num) => {

      if (num > array.length) return [array]
      else if (num === 0) return []


      let newArr = [];
      let spliceArr = array.splice(0, num)
      console.log(spliceArr);

      newArr.push(spliceArr)
      newArr.push(array)
      return newArr
    }
    console.log(go(arr, 0));
    // go(arr, 2)
  </script>
</body>

</html>